//
//  BaseNavigationController.swift
//  maopu
//
//  Created by 黄海波 on 2017/4/1.
//  Copyright © 2017年 maopu. All rights reserved.
//  

import UIKit

class BaseNavigationController: UINavigationController , UIGestureRecognizerDelegate{

    override func viewDidLoad() {
        super.viewDidLoad()

        let customFont:UIFont = UIFont.RegularDefaultFont(16)
        self.navigationBar.barTintColor = UIColor.white
        self.navigationController?.navigationBar.isTranslucent = false
        self.navigationBar.titleTextAttributes = [NSFontAttributeName:customFont , NSForegroundColorAttributeName: UIColor.m_textDeepColor()]
        self.interactivePopGestureRecognizer!.delegate = self
        self.navigationBar.setBackgroundImage(UIImage(named: "nav_background"), for: .default)
        self.navigationBar.shadowImage = UIImage()
    }
    
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    
    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
        if self.viewControllers.count == 0{
            return super.pushViewController(viewController, animated: animated)
        }else if self.viewControllers.count >= 1{
            viewController.hidesBottomBarWhenPushed = true
        }
        super.pushViewController(viewController, animated: animated)
    }
    
    func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
        return (self.childViewControllers.count > 1)
    }
    
    override var supportedInterfaceOrientations : UIInterfaceOrientationMask {
        return UIInterfaceOrientationMask.portrait
    }
    
    override var shouldAutorotate : Bool{
        return false
    }
    

}
